package com.company.common.core.mail;

import java.util.Properties;
import java.util.ResourceBundle;

public class MailSenderInfo
{
  private String mailServerHost;
  private String mailServerPort = "25";
  private String fromAddress;
  private String toAddress;
  private String userName;
  private String password;
  private boolean validate = false;
  private String subject;
  private String content;
  private String[] attachFileNames;

  public Properties getProperties()
  {
    Properties p = new Properties();
    p.put("mail.smtp.host", this.mailServerHost);
    p.put("mail.smtp.port", this.mailServerPort);
    p.put("mail.smtp.auth", this.validate ? "true" : "false");
    return p;
  }

  public MailSenderInfo() {
    ResourceBundle resorce = ResourceBundle.getBundle("email");
    this.mailServerHost = resorce.getString("mail.smtp.host");
    this.mailServerPort = resorce.getString("mail.smtp.port");
    this.validate = true;
    this.userName = resorce.getString("mail.smtp.userName");
    this.password = resorce.getString("mail.smtp.password");
    this.fromAddress = resorce.getString("mail.smtp.fromAddress");
  }

  public String getMailServerHost() {
    return this.mailServerHost;
  }

  public void setMailServerHost(String mailServerHost) {
    this.mailServerHost = mailServerHost;
  }

  public String getMailServerPort() {
    return this.mailServerPort;
  }

  public void setMailServerPort(String mailServerPort) {
    this.mailServerPort = mailServerPort;
  }

  public boolean isValidate() {
    return this.validate;
  }

  public void setValidate(boolean validate) {
    this.validate = validate;
  }

  public String[] getAttachFileNames() {
    return this.attachFileNames;
  }

  public void setAttachFileNames(String[] fileNames) {
    this.attachFileNames = fileNames;
  }

  public String getFromAddress() {
    return this.fromAddress;
  }

  public void setFromAddress(String fromAddress) {
    this.fromAddress = fromAddress;
  }

  public String getPassword() {
    return this.password;
  }

  public void setPassword(String password) {
    this.password = password;
  }

  public String getToAddress() {
    return this.toAddress;
  }

  public void setToAddress(String toAddress) {
    this.toAddress = toAddress;
  }

  public String getUserName() {
    return this.userName;
  }

  public void setUserName(String userName) {
    this.userName = userName;
  }

  public String getSubject() {
    return this.subject;
  }

  public void setSubject(String subject) {
    this.subject = subject;
  }

  public String getContent() {
    return this.content;
  }

  public void setContent(String textContent) {
    this.content = textContent;
  }
}